# Documentation: https://docs.brew.sh/Formula-Cookbook
#                https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Uvconvertor < Formula
  desc "A tool generate compile_commands.json from keilMDK`s .uvprojx file."
  homepage "https://github.com/a3750/uvconvertor"
  url "https://github.com/a3750/uvconvertor.git",
    tag: "v1.0.0",
    revision: "9bbf62a6c5183e562109645c9a5b1f68a215d211"
  license "MIT"
  version "1.0.0"

  bottle do
    root_url "https://github.com/a3750/uvconvertor/releases/download/v1.0.0"
    sha256 cellar: :any_skip_relocation, arm64_sequoia: "08379c17dfec79cfcc71bebfc53eaf7aab65605800ca0a47a5f0f58352b4c43d"
    sha256 cellar: :any_skip_relocation, arm64_sonoma:  "08379c17dfec79cfcc71bebfc53eaf7aab65605800ca0a47a5f0f58352b4c43d"
    sha256 cellar: :any_skip_relocation, arm64_ventura: "08379c17dfec79cfcc71bebfc53eaf7aab65605800ca0a47a5f0f58352b4c43d"
    sha256 cellar: :any_skip_relocation, sequoia:       "462fcc6099ebb6ea76394468d0da08f0e38dd76d38ae11fbb4efea94c5c75028"
    sha256 cellar: :any_skip_relocation, sonoma:        "462fcc6099ebb6ea76394468d0da08f0e38dd76d38ae11fbb4efea94c5c75028"
    sha256 cellar: :any_skip_relocation, ventura:       "462fcc6099ebb6ea76394468d0da08f0e38dd76d38ae11fbb4efea94c5c75028"
    sha256 cellar: :any_skip_relocation, arm64_linux:   "09958a9d334f8d44cc68809dd7ff993f345a2608a9ed64487d61548fc544b5d9"
    sha256 cellar: :any_skip_relocation, x86_64_linux:  "c96888bc604ac6a81a1360f239956ed894a76e2fe7ba5a3a61ba393e14693f02"
  end

  depends_on "git" => :build
  depends_on "rust" => :build

  livecheck do
    url :stable
    regex(/^v?(\d+(?:\.\d+)+)$/i)
  end

  # Additional dependency
  # resource "" do
  #   url ""
  #   sha256 ""
  # end

  def install
    # Remove unrecognized options if they cause configure to fail
    # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method
    system "cargo", "install", *std_cargo_args
  end

  test do
    # `test do` will create, run in and delete a temporary directory.
    #
    # This test will fail and we won't accept that! For Homebrew/homebrew-core
    # this will need to be a test that verifies the functionality of the
    # software. Run the test with `brew test uvConvertor`. Options passed
    # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
    #
    # The installed folder is not in the path, so use the entire path to any
    # executables being tested: `system bin/"program", "do", "something"`.
    system "examples/convert.sh"
  end
end
